<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

if ( ! function_exists('createhtml'))
{
	function createhtml($love)
	{
		$fp = fopen(ENTERPRISE_STYLE_DIR.ENTERPRISE_MODULE, 'r');
		if($fp)
		{
			$html = fgets($fp);
			$data = sprintf($html,$love->restaurant,$love->location,$love->menu_name,$love->price,$love->donation,$love->applicant_phone,$love->startdate,$love->stopdate);
			fclose($fp);
			
			if(is_dir(ENTERPRISE_DIR) == false)
			{
				mkdir(ENTERPRISE_DIR);
				chmod(ENTERPRISE_DIR,0777);
			}
			$fp = fopen(ENTERPRISE_DIR.$love->url.'.html', 'w+');
			fwrite($fp, $data);
			fclose($fp);
			return SITE_URL."xqmx/enterprise/".$love->url.'.html';

		}
		else
		{
			return ENTERPRISE_STYLE_DIR.ENTERPRISE_MODULE." error";
		}
	}
}